﻿using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Collections.Generic;

public partial class _About : System.Web.UI.Page 
{
    enum pageType { About = 2, Groups = 3, Branch = 4 };
    protected LocalFunctions FUNC;
    pageType _pageType;
    private string sBlockTitle;
    protected string sKeywords, sDescription;

    protected void Page_Load(object sender, EventArgs e)
    {
        FUNC = ((Rondo)Master).FUNC;
        sendto.FUNC = FUNC;
        //Calendar1.FUNC = FUNC;
        if (FUNC.LangID == 2)
            tblContent.Attributes.Add("dir", "rtl");

        GetParameters();
        
        Dal.arParams.Clear();
        Dal.arParams.Add((int)_pageType);
        Dal.arParams.Add(FUNC.LangID);
        DataTable DT = Dal.ExecuteDBsp("RD_SelectStaticPageById", Dal.arParams);
        if (DT != null)
        {
            if (DT.Rows.Count > 0)
            {
                Title = DT.Rows[0]["BrowserTitle"].ToString();
                sKeywords = DT.Rows[0]["Keywords"].ToString();
                sDescription = DT.Rows[0]["Description"].ToString();

                divTitle.InnerHtml = string.Format("<h1>{0}</h1>", sBlockTitle);
                ContentTitle.InnerHtml = "<h2>" + DT.Rows[0]["ContentTitle"].ToString() + "</h2>";
                PageContent.InnerHtml = "<p>" + DT.Rows[0]["PageContent"].ToString()+"</p>";
                imgTitle.Src = FUNC.FullAppPath + "/Gallery/" + DT.Rows[0]["imageLink"].ToString();
            }
        }
    }

    private void GetParameters()
    {
        _pageType = (pageType)Convert.ToInt32(Request.QueryString["type"]);
        if (_pageType == 0)
            _pageType = pageType.About;

        switch (_pageType)
        {
            case pageType.About:
                sBlockTitle = FUNC.GetPhrase(8);
                lnkAbout.Attributes.Add("style", (FUNC.LangID == 1) ? FUNC.sSelected : FUNC.sSelectedHeb);
                break;
            case pageType.Branch:
                sBlockTitle = FUNC.GetPhrase(10);
                lnkBranch.Attributes.Add("style", (FUNC.LangID == 1) ? FUNC.sSelected : FUNC.sSelectedHeb);
                break;
            case pageType.Groups:
                sBlockTitle = FUNC.GetPhrase(9);
                lnkGrooups.Attributes.Add("style", (FUNC.LangID == 1) ? FUNC.sSelected : FUNC.sSelectedHeb);
                break;
        }
    }
}
